import os
import importlib

def register_players(platform):
    # 遍历 ./players 目录下的所有文件
    players_dir = "./players"
    for filename in os.listdir(players_dir):
        if filename.endswith(".py"):  # 只处理以 .py 结尾的文件
            player_name = os.path.splitext(filename)[0]  # 移除文件扩展名
            player_module = f"players.{player_name}"
            platform.register_participant(player_name, player_module)
